home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / e / framework.lha / fw / queue.e < prev    next >
Encoding:
Text File  |  1996-01-28  |  499 b   |  29 lines

  1.  
  2. -> a queue is a FIFO collection.
  3. -> Time complexity for data adding is O(1).
  4. -> Time complexity for data searching is O(1).
  5. -> Space complexity is O(n).
  6.  
  7. -> Copyright © Guichard Damien 01/04/1996
  8.  
  9. OPT MODULE
  10. OPT EXPORT
  11.  
  12. MODULE 'fw/bag','fw/list'
  13.  
  14. OBJECT queue OF list
  15. ENDOBJECT
  16.  
  17. -> First element of the queue.
  18. PROC first() OF queue IS self.next
  19.  
  20. -> Remove first element of the queue.
  21. PROC removeFirst() OF queue
  22.   DEF b:PTR TO bag
  23.   IF b:=self.next
  24.     self.next:=b.next
  25.     END b
  26.   ENDIF
  27. ENDPROC
  28.  
  29.